let n = 4
var divisorGame = function (n) {
    let db = new Array(n + 1).fill(false)
    db[1] = false
    for (let i = 2; i <= n; i++) {
        for (let x = 1; x < i; x++) {
            if (i % x === 0) {
                if (!db[i - x]) {
                    db[i] = true
                    break
                }
            }
        }
    }
    return db[n]
};
console.log(divisorGame(n));
